﻿using System.Web.UI;

namespace Eneta.Portal.Forum.Common.Controls
{
    public class OWSTextField : OWSBase
    {
        // Methods
        protected override void Render(HtmlTextWriter wtr)
        {
            wtr.Write("<SCRIPT>fld = new {4}(frm, \"{0}\", \"{1}\", \"{2}\"); fld.fRequired = {3}; {5}fld.IMEMode=\"\"; fld.BuildUI(); </SCRIPT>", new object[] { this.UniqueID, base.Display, base.JavaScriptValue, base.Required.ToString().ToLower(), (this.NumLines == 1) ? "TextField" : "NoteField", (this.NumLines == 1) ? "fld.cchMaxLength = \"\"; fld.cchDisplaySize = \"\"; " : string.Format("fld.stNumLines = \"{0}\"; ", this.NumLines) });
            wtr.Write("&nbsp;<br><SPAN class=ms-formdescription ID={0}>{1}</SPAN>", this.UniqueID, this.Description);
        }

        // Properties
        public int NumLines
        {
            get
            {
                if (this.ViewState["NumLines"] == null)
                {
                    this.NumLines = 1;
                }
                return (int)this.ViewState["NumLines"];
            }
            set
            {
                this.ViewState["NumLines"] = value;
            }
        }
    }


}
